Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[12.0][FIX] Autovacuum cron job #163

Closed
wants to merge 3 commits into from
Closed

[12.0][FIX] Autovacuum cron job #163

wants to merge 3 commits into from

Conversation

naglis
Copy link
Contributor

@naglis naglis commented Aug 3, 2019

state is not set to code on the AutoVacuum Job Queue ir.cron data record, so the default action object_write is assigned to it on creation, as a result, the cron job does nothing when it runs (jobs older than 30 days are not being deleted).

Affected versions: 12.0, this was already fixed for 11.0 in #112

I've also added a test case and a migration to update the record for existing installations (since the record is marked as noupdate="1").

If, like me, you did not notice it for quite a while and now have hundreds of thousands of old jobs (or even more), running the fixed autovacuum cron job will most likely fail due to memory error or a timeout (depends on the setup, of course). To work around that, I've copied the original AutoVacuum Job Queue cron job record and used this for code:

deadline = datetime.datetime.now() - datetime.timedelta(days=31)
model.search([('date_done', '<=', deadline)], limit=10000).unlink()

and setup to run this Cron job e.g. every 5 minutes to clear away the build-up.

Copy link
Member

@guewen guewen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this PR of quality and the detailed description!

Copy link
Contributor

@sebalix sebalix left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Approving, but should we instead cherry-pick a89d1d8 regarding the XML data?

@pedrobaeza pedrobaeza added this to the 12.0 milestone Aug 6, 2019
Copy link
Member

@pedrobaeza pedrobaeza left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it's OK as it is

@guewen
Copy link
Member

guewen commented Aug 8, 2019

/ocabot merge

@OCA-git-bot
Copy link
Contributor

This PR looks fantastic, let's merge it!
Rebased to 12.0-ocabot-merge-pr-163-by-guewen-bump-no, awaiting test results.

OCA-git-bot added a commit that referenced this pull request Aug 8, 2019
Signed-off-by guewen
@OCA-git-bot
Copy link
Contributor

Congratulations, your PR was merged at 380007c. Thanks a lot for contributing to OCA. ❤️

PS: Don't worry if GitHub says there are unmerged commits: it is due to a rebase before merge. All commits of this PR have been merged into 12.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

6 participants